package dev.alm.chatimagedemo.config;

import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class LLMConfig {

    @Value("${llm.api.key}")
    private String dashscopeApiKey;

    @Value("${llm.base.url}")
    private String dashscopeBaseUrl;

    @Value("${llm.model.name}")
    private String dashscopeModelName;

    @Bean
    public ChatModel chatModel() {
        OpenAiChatModel model = OpenAiChatModel.builder()
                .apiKey(dashscopeApiKey)
                .baseUrl(dashscopeBaseUrl)
                .modelName(dashscopeModelName)
                .build();
        return model;
    }
}
